<?php
namespace Models;

class Token
{
	private $_userId;
	private $_tokenId;
	private $_token;
	private $_ip;
	
	public $isValid = true;
	
	/**
	 * Instansiera objekt
	 * @param $userId int
	 * @param $tokenId int
	 * @param $token string
	 * @param $ip string
	 */
	public function __construct($tokenId, $userId, $token, $ip)
	{
		$this->_userId = $userId;
		$this->_tokenId = $tokenId;
		$this->_token = $token;
		$this->_ip = $ip;
		
		if(!is_numeric($userId) || !is_numeric($tokenId))
			$this->isValid = false;
		
		if($token = "" || $ip == "")
			$this->isValid = false;
	}
	
	public function UserId() { return $this->_userId; }
	
	public function TokenId() { return $this->_tokenId; }
	
	public function Token() { return $this->_token; }
	
	public function Ip() { return $this->_ip; }
}

?>